package com.llbnk.pojo.model;

import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;

/**
 * @author shkstart
 * @create 2022-08-21 15:18
 */
@Data
@NoArgsConstructor
public class ItemModel implements Serializable {

    private Integer id;


    //预约活动名称
    @NotBlank(message = "预约活动名称不能为空")
    private String title;

    //预约活动价格
    @NotNull(message = "预约活动价格不能为空")
    @Min(value = 0, message = "预约活动价格必须大于0")
    private BigDecimal price;

    //预约活动限额人数
    @NotNull(message = "预约活动限额人数库存必须填写")
    private Integer stock;

    //预约活动描述
    @NotBlank(message = "预约活动描述不能为空")
    private String description;

    //预约活动的已经预约数
    private Integer sales;

    //预约活动描述图片的url
    @NotBlank(message = "预约活动图片信息不能为空")
    private String imgUrl;

    //使用聚合模型,如果promoModel不为空，则表示其还拥有未结束的秒杀活动
    private PromoModel promoModel;

    @Override
    public String toString() {
        return "ItemModel{" +
                "id=" + id +
                ", title='" + title + '\'' +
                ", price=" + price +
                ", stock=" + stock +
                ", description='" + description + '\'' +
                ", sales=" + sales +
                ", imgUrl='" + imgUrl + '\'' +
                ", promoModel=" + promoModel +
                '}';
    }
}
